package cn.controller;

import cn.common.Helpers;
import cn.model.AcctUser;
import cn.model.ApuConfig;
import cn.model.ApuNums;
import com.github.abel533.echarts.Option;
import com.github.abel533.echarts.axis.CategoryAxis;
import com.github.abel533.echarts.axis.ValueAxis;
import com.github.abel533.echarts.code.Magic;
import com.github.abel533.echarts.code.MarkType;
import com.github.abel533.echarts.code.Tool;
import com.github.abel533.echarts.code.Trigger;
import com.github.abel533.echarts.data.PointData;
import com.github.abel533.echarts.feature.MagicType;
import com.github.abel533.echarts.series.Bar;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ExtendedModelMap;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;

import javax.validation.Valid;
import java.util.*;

/**
 * Created by wushifeng on 2017/3/14.
 */
@Controller
@RequestMapping("/mv")
public class ModelViewController {

    @RequestMapping("show/{userId}")
    public String showInfo(ModelMap modelMap, @PathVariable String userId){
        AcctUser u = new AcctUser("s1", "dog");
        u.setRegisterTime(new Date());
        modelMap.addAttribute("userInfo", u);
        return "mv/showInfo";
    }

    @RequestMapping(value = "m")
    public ModelAndView m(){
        Model model = new ExtendedModelMap();

        AcctUser u = new AcctUser("s2", "dog");
        u.setRegisterTime(new Date());

        model.addAttribute("userInfo", u);
        return new ModelAndView("mv/showInfo", model.asMap());
   }
}
